<!--继承模板-->
{extend name="common/index" /}
<!--header-->
{block name="header"}
<div class="header">
	<div class="top">
		<div class="wrapper">
			<img src="/static/index/img/logo.png" alt="logo" class="logo">
			<span>加盟什么好--专业的加盟网址导航</span>
			<ul class="link fr">
				<li><a class="nav" href="/">返回首页</a></li>
				<li><a class="nav" onclick="addBookmark('加盟什么好','https://www,jiamengshenmehao.com')">加入收藏</a></li>
				<li><a class="nav" href="__INDEX__/aboutus/us">关于我们</a></li>
				<li><a class="nav" href="__INDEX__/aboutus/ac">联系我们</a></li>
				<li class="last_li">
					<a class="nav" href="#">行业导航<i class="iconfont">&#xe612;</i></a>
					<div class="popBox clearfix">
                    	{foreach $cateInfo as $key => $value}
						<dl>
                    		<dt><a href="{$value.url}">{$value.name} &gt;</a></dt>
                    		<dd>
								{foreach $value.child as $k => $v}
                    			<a href="{$value.url}/#{$v.id}">{$v.name}</a>
								{/foreach}

                    		</dd>
                    	</dl>
						{/foreach}
                    </div>
				</li>
			</ul>
		</div>
	</div>
	<div class="search">
		<div class="wrapper clearfix">
			<div class="fl logoBox clearfix">
				<a href="http://www.jiamengshenmehao.com">
				<img src="/static/index/img/search_logo.png" alt="" class="searchLog">
				</a>
			</div>
            <form class="searchBox clearfix" action="__INDEX__/brand/brandlist">
            	<input name="keyword" placeholder="搜你想搜的" />
				<button>搜索</button>
				<p class="clear"></p>
				<div class="relate clearfix">
					{foreach $reacHeaderBrand as $key => $value}
					{if $key > 1}
					<a href="__WIKI__?id={$value.id}">{$value.title}</a>
					{/if}
					{/foreach}
				</div>
            </form>
			<div class="other">
				<ul>
					{foreach $reacHeaderBrand as $key => $value}
					{if $key < 2}
					<li>
						<a target="_blank" href="__WIKI__?id={$value.id}">{$value.title}</a>
					</li>
					{/if}
					{/foreach}
				</ul>
			</div>
		</div>
	</div>
</div>
{/block}
<!--conteng-->
{block name="content"}
<div class="indexBox">
	<ul class="clearfix">
		{foreach $links.all as $key => $value}
		<li class="over">
			<a target="_blank" href="{$value.url}">
				<img src="{$value.logo}">
				<span>{$value.title}</span>
			</a>
		</li>
		{/foreach}
	</ul>
	<ul class="clearfix">
		{foreach $links.ver as $key => $value}
		<li class="over">
			<a target="_blank" href="{$value.url}">
				<img src="{$value.logo}">
				<span>{$value.title}</span>
			</a>
		</li>
		{/foreach}
	</ul>
</div>
<div class="indexItem">
	{foreach $cate as $key => $value}
	<div class="clearfix row">
		<a class="name" href="/index/brand/brandlist?cid={$value.id}">{$value.name}</a>
		<ul class="clearfix">
			{foreach $value.data as $k => $v}
			<li class="over"><a target="_blank" href="{$v.url}">{$v.title}</a></li>
			{/foreach}
		</ul>
		<a class="moreBtn" ta href="{$value.url}">更多&gt;&gt;</a>
	</div>
	{/foreach}

</div>
<!-- 资讯 -->
<div class="newsContent clearfix">
	<div class="newsBox">
		<ul class="newsTab">
			<li class="active">加盟攻略</li>
			<li>盟友探店</li>
			<li>加盟日记</li>
		</ul>
		<div class="newsText">
			{if $newsList[1]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[1]['ad']['id']}">
						<img src="{$newsList[1]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[1]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[2]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[2]['ad']['id']}">
						<img src="{$newsList[2]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[2]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[3]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[3]['ad']['id']}">
						<img src="{$newsList[3]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[3]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
		</div>
	</div>
	<div class="newsBox">
		<ul class="newsTab">
			<li class="active">开店攻略</li>
			<li>创业指南</li>
			<li>选址技巧</li>
		</ul>
		<div class="newsText">
			{if $newsList[4]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[4]['ad']['id']}">
						<img src="{$newsList[4]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[4]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[5]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[5]['ad']['id']}">
						<img src="{$newsList[5]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[5]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[6]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[6]['ad']['id']}">
						<img src="{$newsList[6]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[6]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
		</div>
	</div>
	<div class="newsBox">
		<ul class="newsTab">
			<li class="active">创业故事</li>
			<li>经营技巧</li>
			<li>活动专题</li>
		</ul>
		<div class="newsText">
			{if $newsList[7]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[7]['ad']['id']}">
						<img src="{$newsList[7]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[7]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[8]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[8]['ad']['id']}">
						<img src="{$newsList[8]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[8]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[9]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[9]['ad']['id']}">
						<img src="{$newsList[9]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[9]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
		</div>
	</div>
	<div class="newsBox">
		<ul class="newsTab">
			<li class="active">如何去做加盟</li>
			<li>如何打造成一个好项目</li>
		</ul>
		<div class="newsText">
			{if $newsList[10]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[10]['ad']['id']}">
						<img src="{$newsList[10]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[10]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $newsList[11]['ad'] neq []}
			<dl>
				<dt>
					<a href="__INDEX__/news/detail?id={$newsList[11]['ad']['id']}">
						<img src="{$newsList[11]['ad']['img']}">
					</a>
					<span class="tip">广告</span>
				</dt>
				<dd>
					{foreach $newsList[11]['list'] as $key => $value}
					<p class="over clearfix">
						<span class="tip">{$value.cname}</span>
						<a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a>
					</p>
					{/foreach}
				</dd>
			</dl>
			{/if}
		</div>
	</div>
</div>
<!-- 品牌百科 -->
<div class="wikiBox">
	<div class="wikiTitle clearfix">
		<h3>品牌百科</h3>
		<a href="__INDEX__/brand/brandlist">更多<span class="iconfont icon_arrow">&#xe609;</span></a>
	</div>
	<div class="wikiList clearfix">
		{foreach $brand as $key => $value}
		<dl class="clearfix">
			<dt>
				<a href="__WIKI__?id={$value.id}">
					<img src="{$value.img}">
				</a>
			</dt>
			<dd>
				<p class="name over"><a href="__WIKI__?id={$value.id}">{$value.title}</a></p>
				<span class="over">人气：{$value.read_num}</span>
				<span class="over">特色：{$value.ame}</span>
			</dd>
		</dl>
		{/foreach}
	</div>
</div>
<div class="inforBox wrapper clearfix">
	<div class="fl">
		<div class="choiceBox">
			<h3 class="sideTitle">精选</h3>
			<a class="choicePic" href="__INDEX__/news/detail?id={$recoNews['img']['id']}">
				<img src="{$recoNews['img']['img']}">
				<span class="over">{$recoNews['img']['title']}</span>
			</a>
			<ul class="choiceList">
				{foreach $recoNews.list as $key => $value}
				<li class="over"><a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a></li>
				{/foreach}
			</ul>
		</div>
		<div class="itemTop">
			<h3>搜索热点</h3>
			<ul>
				{foreach $recoBrand as $key => $value}
				<li class="clearfix">
					<span>{$key+1}</span>
					<a class="over" href="__WIKI__?id={$value.id}">{$value.title}</a>
					<i>{$value.read_num}</i>
				</li>
				{/foreach}
			</ul>
		</div>
	</div>
	<div class="fr updateBox">
		<div class="updateTab clearfix">
			<label class="lab">最新</label>
			<div class="swiper-container">
				<ul class="swiper-wrapper">
					{foreach $cate as $key => $value}
					<li cate="{$value.id}" class="swiper-slide {if $key == 0}current{/if}">{$value.name}</li>
					{/foreach}
				</ul>
				<div class="swiper-pagination" style="display:none;"></div>
			</div>
			<div class="swiper-button-next iconfont">&#xe609;</div>
			<div class="swiper-button-prev iconfont">&#xe8a9;</div>
		</div>

		<div class="updateContent">
			{if $news neq []}
			{if $news.news neq []}
			{foreach news.news as $key => $value}
			<dl class="dl01 clearfix">
				<dt class="fl"><a href="__INDEX__/news/detail?id={$value.id}"><img src="{$value.img}"></a></dt>
				<dd class="fr">
					<p class="titleTar over"><a href="__INDEX__/news/detail?id={$value.id}">{$value.title}</a></p>
					<p class="text">
						{$value.sign}
					</p>
					<p class="remark">{$value.author} &nbsp;&nbsp;&nbsp; {$value.addtime}</p>
				</dd>
			</dl>
			{/foreach}
			{/if}
			{if $news.ad neq []}
			<dl class="dl02">
				<dt class="over"><a href="__INDEX__/news/detail?id={$news.ad.id}">{$news.ad.title}</a></dt>
				<dd class="clearfix dd_ad">
					{foreach $news.ad.img as $value}
					<a href="__INDEX__/news/detail?id={$news.ad.id}"><img src="{$value}"></a>
					{/foreach}
				</dd>
			</dl>
			{/if}
			{if $news.imgs neq []}
			<dl class="dl02">
				<dt class="over"><a href="__INDEX__/news/detail?id={$news.imgs.id}">{$news.imgs.title}</a></dt>
				<dd class="clearfix">
					{foreach $news.imgs.img as $value}
					<a href="__INDEX__/news/detail?id={$news.imgs.id}"><img src="{$value}"></a>
					{/foreach}

				</dd>
			</dl>
			{/if}
			{/if}
			<!--加载进度条 -->
		    <div class="waterfllow-loading">
		        <img class="loading-progress" src="/static/index/img/loading.gif" />
		    </div>
		</div>
	</div>
</div>
<!--数据类型-->
<input type="hidden" id="cate" value="2">
<!--数据类型end-->
<script type="text/javascript" src="/static/index/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/public/layui/layui.js"></script>
<script>
	var page = 0;
	var returnLog = true;
	function scrollTop() {
        return Math.max(document.body.scrollTop, document.documentElement.scrollTop);
    }
    function documentHeight() {
        return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
    }
    function windowHeight(){
        return (document.compatMode == "CSS1Compat") ? document.documentElement.clientHeight : document.body.clientHeight;
    }
    $(window).on('scroll', function() {
        // console.log(documentHeight());
        // console.log(windowHeight());
        if(scrollTop() + windowHeight() >= (documentHeight() - 50/*滚动响应区域高度取50px*/)){
			//->显示进度条
			$('.waterfllow-loading').addClass('active');
			// console.log('滚动到底部了!');
            if(returnLog){
                waterallowData();
            }
        }else{
        	//->隐藏进度条
        	$('.waterfllow-loading').removeClass('active');
        }
    });
 
    //-> 数据加载
    function waterallowData() {
		//ajax
    	page ++;
		var ahtml = '';
		//请求ajax
		var cid = $("#cate").val();
		$.ajax({
			type: "POST",
			url: "__INDEX__/news/getNewsType12List",
			data:{
				'cate_id':cid,
				'page':page,
			},
			success: function(data){
				console.log('return',data);
				data = jQuery.parseJSON(data);
				if(data.code == 200){
					console.log('追加数据');
					var list = data.data.list;
					var imgs = data.data.imgs;
					console.log('list',list);
					if(list){
						$.each(list,function (index,item) {
							console.log('item',item);
							ahtml +=
									'<dl class="dl01 clearfix">' +
									'<dt class="fl"><a href="__INDEX__/news/detail?id='+item.id+'">' +
									'<img src="'+item.img+'">' +
									'</a></dt><dd class="fr">' +
									'<p class="titleTar over">' +
									'<a href="__INDEX__/news/detail?id='+item.id+'">'+item.title+'</a>' +
									'</p><p class="text">'+item.sign+'</p>' +
									'<p class="remark">'+item.author+'&nbsp;&nbsp;&nbsp; '+item.addtime+' </p></dd>' +
									'</dl>';
						})
					}
					if(imgs){
						ahtml +=
								'<dl class="dl02">' +
								'<dt class="over"><a href="__INDEX__/news/detail?id='+imgs.id+'">'+imgs.title+'</a></dt>' +
								'<dd class="clearfix">';
						$.each(imgs.img,function (index,item) {
							console.log('item',item);
							ahtml  += '<a href="__INDEX__/news/detail?id='+imgs.id+'"><img src="'+item+'"></a>';
						})
						ahtml  +=
								'</dd>' +
								'</dl>';
					}
					//->追加HTML到waterfllow-loading的前面
					$(".waterfllow-loading").before(ahtml);
					//->隐藏进度条
					$('.waterfllow-loading').removeClass('active');
				}else{
					// console.log('滚动到底部了!');
					layui.use('layer', function(){
						var layer = layui.layer;

						layer.msg('滚动到底部了');
						$('.loading-progress').hide();
					});
                    returnLog = false;
					return false;
				}
			}
		});
        //->追加HTML到waterfllow-loading的前面
        // $(".waterfllow-loading").before(ahtml);
    }
    // $('.updateTab .swiper-slide').click(function(){
    //     $(this).addClass('current').siblings().removeClass('current');
	// })
	$('.updateTab .swiper-slide').click(function(){
		page = 0;
		var cate_id = $(this).attr('cate');
		$("#cate").val(cate_id);
		console.log('cate_id',cate_id);
		//ajax
		$.ajax({
			type: "POST",
			url: "__INDEX__/news/getFooterNewsView",
			data:{
				'cate_id':cate_id,
			},
			success: function(data){
				// console.log('return',data);
				data = jQuery.parseJSON(data);
				var ahtml = '';
				if(data.code == 200){
					// console.log('code',data.code);
					var news = data.data.news;
					var ad = data.data.ad;
					var imgs = data.data.imgs;
					if(news){
						// console.log('news',news);
						$.each(news,function (index,item) {
							// console.log('news.item',item);
							ahtml += '<dl class="dl01 clearfix"><dt class="fl"><a href="__INDEX__/news/detail?id='+item.id+'"><img src="'+item.img+'"></a></dt><dd class="fr"><p class="titleTar over"><a href="__INDEX__/news/detail?id='+item.id+'">'+item.title+'</a></p><p class="text">'+item.sign+'</p><p class="remark">'+item.author+' &nbsp;&nbsp;&nbsp; '+item.addtime+'</p></dd></dl>';
						})
					}
					// console.log('html1',ahtml);
					if(ad){
						ahtml += '<dl class="dl02"><dt class="over"><a href="__INDEX__/news/detail?id='+ad.id+'">'+ad.title+'</a></dt><dd class="clearfix dd_ad">';
						$.each(ad.img,function (index,item) {
							console.log('ad.img.img',item);
							ahtml += '<a href="__INDEX__/news/detail?id='+ad.id+'"><img src="'+item+'"></a>';
						})
						ahtml+='</dd></dl>';
					}
					// console.log('html2',ahtml);
					if(imgs){
						// console.log('imgs',imgs);
						ahtml +='<dl class="dl02"><dt class="over"><a href="__INDEX__/news/detail?id='+imgs.id+'">'+imgs.title+'</a></dt><dd class="clearfix">';
						$.each(imgs.img,function (index,item) {
							// console.log('imgs.img',item);
							ahtml +='<a href="__INDEX__/news/detail?id='+imgs.id+'"><img src="'+item+'"></a>';
						})
						ahtml +='</dd></dl>';
					}
					ahtml +='<div class="waterfllow-loading"><img class="loading-progress" src="/static/index/img/loading.gif" /></div>';
					console.log('html',ahtml);
					$(".updateContent").html(ahtml);
				}else{
                    returnLog = false;
					layui.use('layer', function(){
						var layer = layui.layer;
						layer.msg('滚动到底部了');
						$('.loading-progress').hide();
					});
					$(".updateContent").html(false);
				}
			}
		});
		$(this).addClass('current').siblings().removeClass('current');
	})
</script>
{/block}
